both {rx,tx}_comms_area, and one (and just one) of them failed. As we
were
doing a single test for both, returning would leave one of them
allocated.
Signed-off-by: Glauber de Oliveira Costa <glommer@br.ibm.com>
return 0;
netif->tx_comms_area = alloc_vm_area(PAGE_SIZE);
+ if (netif->tx_comms_area == NULL)
+ return -ENOMEM;
netif->rx_comms_area = alloc_vm_area(PAGE_SIZE);
- if (netif->tx_comms_area == NULL || netif->rx_comms_area == NULL)
+ if (netif->rx_comms_area == NULL) {
+ free_vm_area(netif->tx_comms_area);
return -ENOMEM;
+ }
err = map_frontend_pages(netif, tx_ring_ref, rx_ring_ref);
if (err) {